using DbEntities.Entities;
using NHibernate;
using NHibernate.Criterion;

namespace DataLayer.Repositories
{
    public class MessageAssembliesRepository : BaseRepository<MessageAssembly, long>, IMessageAssembliesRepository
    {
        public MessageAssembliesRepository(ISession session)
            : base(session)
        {
        }

        public MessageAssembly FindByMessageAssemblyVersionId(string messageAssemblyVersionId)
        {
            return Session.CreateCriteria(typeof(MessageAssembly))
               .Add(Restrictions.Eq("MessageAssemblyVersionId", messageAssemblyVersionId))
               .UniqueResult<MessageAssembly>();
        }
    }
}